<!DOCTYPE html> 
<html lang="en"> 
<head> 
<meta charset="UTF-8"> 
<meta name="viewport" content="width=device-width, initial-scale=1.0"> 
<title>示例19</title> 
<script> 
   // 声明式函数获取名称 
   function foo() {} 
   console.log(foo.name); // foo 
   //匿名函数获取名称 
   var func = function () {}; 
   console.log(func.name); // func 
   </script> 
 </head> 
 <body></body> 
 </html> 